StateMachineEntityManager<TContext, TEntity, TId, TStateType>
A Manager inheriting fromTEntity’s current State.
Syntax
Inheritance
Constructors
StateMachineEntityManager
Parameters
- dataContext
TContext: Theinstance to use for the database connection. Should be injected by the DI container. - messagePublisher
IMessagePublisher: The SimpleMessageBusinstance to use to publish Messages to a Queue. Should be injected by the DI container.
Properties
StateTypes
Returns
List<TStateType>Methods
Initialize
SetCancelledAsync
Parameters
- entity
TEntity: The entity to update.
Returns
Task<bool> True if the state was successfully updated; otherwise, false.SetCompletedAsync
Parameters
- entity
TEntity: The entity to update.
Returns
Task<bool> True if the state was successfully updated; otherwise, false.SetCreatedAsync
Parameters
- entity
TEntity: The entity to update.
Returns
Task<bool> True if the state was successfully updated; otherwise, false.SetFailedAsync
Parameters
- entity
TEntity: The entity to update. - errorMessage string: Optional error message (currently not used in implementation).
- errorDetail string: Optional error detail (currently not used in implementation).
Returns
Task<bool> True if the state was successfully updated; otherwise, false.UpdateStateAsync
Parameters
- entity
TEntity: The entity to update. - sortOrder int: The sort order of the target state type.
Returns
Task<bool> True if the state was successfully updated; otherwise, false.Exceptions
[Exception](https://learn.microsoft.com/dotnet/api/system.exception): Thrown when no state type is found with the specified sort order.